package com.anjubao.parking.municipal.roadside.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author zhangyunbo
 * @date 2019/6/23 18:40
 */
@Getter
@AllArgsConstructor
public enum AlarmTypeEnum {
    Unknown("00", "未知异常",""),
    UnknownRepair("50", "未知异常恢复",""),
    VideoShade("01", "视频遮挡",""),
    VideoShadeRepair("51", "视频遮挡恢复",""),
    VedioPilePosiAbnormal("02", "车位桩位置异常","视频桩倾斜或倒伏"),
    VedioPilePosiAbnormalRepair("52", "车位桩位置异常恢复","视频桩倾斜或倒伏"),
    SlotAbnormal("03", "车位异常","车位被其他物体占据"),
    SlotAbnormalRepair("53", "车位异常恢复","车位被其他物体占据"),
    AcrossParking("04", "跨位停车",""),
    AcrossParkingRepair("54", "跨位停车恢复",""),
    HalfWayParking("05", "半侧位停车",""),
    HalfWayParkingRepair("55", "半侧位停车恢复",""),
    RepeatParking("06", "反复入位停车",""),
    RepeatParkingRepair("56", "反复入位停车恢复",""),
    InclinedPparking("07", "斜位停车",""),
    InclinedPparkingRepair("57", "斜位停车恢复",""),
    RetrogradeParking("08", "逆行停车",""),
    RetrogradeParkingRepair("58", "逆行停车恢复",""),
    WaterLevelHigh("0A", "水位过高",""),
    WaterLevelHighRepair("5A", "水位恢复",""),
    Others("09", "其他异常",""),
    OthersRepair("59", "其他异常恢复",""),
    manualsnapctrl("99", "手动抓拍","");

    private String code;

    private String desc;

    private String notes;

    public static String getDescByCode(String code) {
        for (AlarmTypeEnum e : AlarmTypeEnum.values()) {
            if (e.getCode().equals(code)) {
                return e.getDesc();
            }
        }
        return null;
    }

    public static String getNotesByCode(String code) {
        for (AlarmTypeEnum e : AlarmTypeEnum.values()) {
            if (e.getNotes().equals(code)) {
                return e.getNotes();
            }
        }
        return null;
    }
    public static Boolean exist(Integer code) {
        for (AlarmTypeEnum e : AlarmTypeEnum.values()) {
            if (e.getCode().equals(code)) {
                return true;
            }
        }
        return false;
    }
}